package com.steward.controller.car;

import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.annotations.Param;
import org.apache.log4j.Logger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.steward.commons.Result;
import com.steward.dto.card.CarBandDTO;
import com.steward.dto.card.CarTypeDTO;
import com.steward.dto.card.SeriseDTO;
import com.steward.dto.card.UserCardDTO;
import com.steward.model.mobCarset.MobCarset;
import com.steward.server.car.CarService;
import com.steward.server.user.UserService;

/**
 * 用户接口
 * 
 * @author mastercheng
 * @since 2017-03-07 20:43:53
 */
@RestController
public class CarController {

	private static Logger logger = Logger.getLogger(CarController.class);

	@Resource
	private CarService carService;

	/**
	 * 查询车辆品牌列表
	 * 
	 * @param account，
	 * @return
	 */
	@GetMapping("/users/ver1/queryCarBandList")
	public @ResponseBody String queryCarBandList() {
		Result<List<CarBandDTO>> result = carService.queryCarBandList();
		return JSONObject.toJSONString(result, SerializerFeature.WriteMapNullValue);
	}

	/**
	 * 根据品牌查车系
	 *
	 * @param bandId，
	 * @return
	 */
	@GetMapping("/users/ver1/querySerisesByBand/{bandId}")
	public @ResponseBody String querySerisesByBand(@PathVariable("bandId")String bandId) {
		Result<List<SeriseDTO>> result = carService.querySerisesByBandId(bandId);
		return JSONObject.toJSONString(result, SerializerFeature.WriteMapNullValue);
	}


	/**
	 * 根据车系查车型列表
	 *
	 * @param account，
	 * @return
	 */
	@GetMapping("/users/ver1/queryCarTypeBySerise/{seriseId}")
	public @ResponseBody String queryCarTypeBySerise(@PathVariable("seriseId")String seriseId) {
		Result<List<CarTypeDTO>> result = carService.queryCarTypeBySerise(seriseId);
		return JSONObject.toJSONString(result, SerializerFeature.WriteMapNullValue);
	}

}
